import { HtmlNode, HtmlNodeModel, GraphModel, NodeConfig } from '@logicflow/core'
import { getBpmnId } from '../getBpmnId'
import './events.scss'
class LineEventModel extends HtmlNodeModel {
  static extendKey = 'StartEventModel'
  constructor(data: NodeConfig, graphModel: GraphModel) {
    if (!data.id) {
      data.id = `startEvent_${getBpmnId()}`
    }
    super(data, graphModel)
  }
  setAttributes(): void {
    this.width = 1450
    this.height = 1
  }
}

class LineEventView extends HtmlNode {
  static extendKey = 'LineEventNode'
  setHtml(rootEl: HTMLElement) {
    const el = document.createElement('div')
    const html = `
      <div class="line-wrapper">
				
      </div>
    `
    el.innerHTML = html
    // 需要先把之前渲染的子节点清除掉。
    rootEl.innerHTML = ''
    rootEl.appendChild(el)
  }
}

const LineEvent = {
  type: 'bpmn2:lineEvent',
  view: LineEventView,
  model: LineEventModel,
}

export { LineEventModel, LineEventView }
export default LineEvent
